﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Practices.EnterpriseLibrary.Data;
using Enterprise.DataFactory;
using Enterprise.Infrastructure;
using Enterprise.Model.OfficeDocument;
namespace Enterprise.Data.OfficeDocument
{
    /// <summary>
    /// 公文签收
    /// </summary>
    public class OfficeRecevieData
    {
        /// <summary>
        ///  签收数据列表
        /// </summary>
        /// <returns></returns>
        public List<OfficeRecevieEntity> OfficeRecevieList()
        {
            List<OfficeRecevieEntity> list = new List<OfficeRecevieEntity>();
            string cmd = "Select * from OFFICE_RECEVIE";
            IDataReader dr = DbExecute.DataReader(cmd);
            while (dr.Read())
            {
                OfficeRecevieEntity entity = new OfficeRecevieEntity();
                if (!Convert.IsDBNull(dr["ORID"])) entity.ORID = Convert.ToInt32(dr["ORID"]);
                if (!Convert.IsDBNull(dr["OID"])) entity.OID = Convert.ToString(dr["OID"]);
                if (!Convert.IsDBNull(dr["ORUSERID"])) entity.ORUSERID = Convert.ToInt32(dr["ORUSERID"]);
                if (!Convert.IsDBNull(dr["ORTIME"])) entity.ORTIME = Convert.ToDateTime(dr["ORTIME"]);
                list.Add(entity);
            }
            dr.Close();
            return list;
        }

        /// <summary>
        /// 签收数据操作方法
        /// </summary>
        /// <param name="cmd"></param>
        public void Execute(string cmd)
        {
            DbExecute.Execute(cmd);
        }
    }
}
